import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import { terser } from '@rollup/plugin-terser';

export default {
  input: 'src/index.js', // 输入文件路径
  output: [
    {
      file: 'dist/index.cjs.js',
      format: 'cjs', // CommonJS 规范
      sourcemap: true
    },
    {
      file: 'dist/index.esm.js',
      format: 'es', // ES Module 规范
      sourcemap: true
    },
  ],
  plugins: [
    resolve(),
    commonjs(),
    json(),
    terser() // 压缩代码
  ]
};